/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author Mr-Quick
 */
@Entity
@Table(name = "savemessage")
@NamedQueries({
    @NamedQuery(name = "Savemessage.findAll", query = "SELECT s FROM Savemessage s"),
    @NamedQuery(name = "Savemessage.findByIdmessage", query = "SELECT s FROM Savemessage s WHERE s.idmessage = :idmessage")})
public class Savemessage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idmessage")
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Integer idmessage;
    @JoinColumn(name = "IDUser", referencedColumnName = "IDUser")
    @ManyToOne
    private SwhUser iDUser;
    @JoinColumn(name = "IdHouse", referencedColumnName = "IdHouse")
    @ManyToOne
    private House idHouse;

    public Savemessage() {
    }

    public Savemessage(Integer idmessage) {
        this.idmessage = idmessage;
    }

    public Integer getIdmessage() {
        return idmessage;
    }

    public void setIdmessage(Integer idmessage) {
        this.idmessage = idmessage;
    }

    public SwhUser getIDUser() {
        return iDUser;
    }

    public void setIDUser(SwhUser iDUser) {
        this.iDUser = iDUser;
    }

    public House getIdHouse() {
        return idHouse;
    }

    public void setIdHouse(House idHouse) {
        this.idHouse = idHouse;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmessage != null ? idmessage.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Savemessage)) {
            return false;
        }
        Savemessage other = (Savemessage) object;
        if ((this.idmessage == null && other.idmessage != null) || (this.idmessage != null && !this.idmessage.equals(other.idmessage))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Savemessage[ idmessage=" + idmessage + " ]";
    }
    
}
